/*
 * WidgetContainer.h
 *
 *	Author: stravant
 *	Description:
 *		
 */

#ifndef WIDGETCONTAINER_H_
#define WIDGETCONTAINER_H_

#include "Widget.h"

namespace tbt {

/*
 * A container which contains only one other widget,
 * which can be accessed and changed.
 */
class WidgetContainerOne: public Widget {
public:
	WidgetContainerOne() {}
	virtual ~WidgetContainerOne() {}

	Ref<Widget> getContent() const {return mContent; }
	void setContent(Ref<Widget> widget) {
		if (mContent)
			removeChild(mContent);
		if (widget)
			addChild(widget);
		mContent = widget;
	}

private:
	Ref<Widget> mContent;
};


/*
 * A container which contains many widgets, in no
 * particular order.
 */
class WidgetContainerMany: public Widget {
public:
	void addContent(Ref<Widget> child) {
		addChild(child);
	}

	void removeContent(Ref<Widget> child) {
		removeChild(child);
	}
};


/*
 * A widget containing many widgets and positinging them
 * in an absolute manor. This container simply reads
 * desired Position/Size of it's children and uses them
 * to do layout.
 *
 * Pos + Size:				Put at pos with size
 * Pos + kSizeAny:			Put at pos + Fill remaining space
 * kPositionAny + kSizeAny:	Fill
 * kPositionAny + Size:		At origin + With size
 */
class WidgetContainerAbsolute: public WidgetContainerMany {
public:
	void onLayout();
};

}

#endif /* WIDGETCONTAINER_H_ */


















